//
//  XDPersonTableViewCell.m
//  Le way walkers
//
//  Created by dlios on 15-5-25.
//  Copyright (c) 2015年 LTXZ. All rights reserved.
//

#import "XDPersonTableViewCell.h"
#import "UIImageView+WebCache.h"
@interface XDPersonTableViewCell()
@property (nonatomic, retain) UILabel *nameLabel;
@property (nonatomic, retain) UILabel *timeLable;
@property (nonatomic, retain) UILabel *popular_place_strLable;
@property (nonatomic, retain) UIImageView *cover_imageView;
@property (nonatomic, retain) UIImageView *ImageView;
@property (nonatomic, retain) UIView *UIView1;
@property (nonatomic, retain) UIView *UIView2;
@property (nonatomic, retain) UIImageView *ImageView1;
@end
@implementation XDPersonTableViewCell
- (void)dealloc
{
    [_nameLabel release];
    [_cover_imageView release];
    [_timeLable release];
    [_popular_place_strLable release];
    [_ImageView release];
    [_UIView1 release];
    [_UIView2 release];
    [_ImageView1 release];
    [super dealloc];
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.UIView1 = [[[UIView alloc]init]autorelease];
        [self.contentView addSubview:_UIView1];
        _UIView1.backgroundColor = [UIColor colorWithRed:255/255.0 green:251/255.0 blue:240/255.0 alpha:1];
        
        self.UIView2 = [[[UIView alloc]init]autorelease];
        _UIView2.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:_UIView2];
        
        
        self.ImageView1 = [[UIImageView alloc]init];
        [_UIView2 addSubview:_ImageView1];
        
        
        self.nameLabel = [[[UILabel alloc]init]autorelease];
        [self.contentView addSubview:_nameLabel];
        
        
        
        self.cover_imageView = [[[UIImageView alloc]init]autorelease];
        [self.contentView addSubview:_cover_imageView];
        
        
        
        self.timeLable = [[[UILabel alloc]init]autorelease];
        [self.contentView addSubview:_timeLable];
        
        
        
        self.popular_place_strLable = [[[UILabel alloc]init]autorelease];
        [self.contentView addSubview:_popular_place_strLable];
        
        self.ImageView = [[[UIImageView alloc]init]autorelease];
        [self.contentView addSubview:_ImageView];
    
    }
    return self;
}



-(void)layoutSubviews
{
    [super layoutSubviews];
    _UIView1.frame =CGRectMake(0, 0, self.contentView.frame.size.width, 120);
    
    _UIView2.frame = CGRectMake(10,10, self.contentView.frame.size.width-20, 110);
    
    _ImageView1.frame = CGRectMake(self.contentView.frame.size.width-60, 0, 40, 40);
    
    
    _nameLabel.frame = CGRectMake(135, 10,self.contentView.frame.size.width-10-110-25-40, 60);
    _nameLabel.numberOfLines = 0;
    
     [_nameLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:17]];
    _nameLabel.textColor = [UIColor colorWithRed:50 / 255.0 green:179 / 255.0 blue:255 / 255.0 alpha:1];
    
    
    _timeLable.frame = CGRectMake(135, 65, 200, 25);
    [_timeLable setFont:[UIFont systemFontOfSize:14]];
    _timeLable.textColor = [UIColor grayColor];

    
    
    _popular_place_strLable.frame = CGRectMake(135, 85, 200, 25);
    [_popular_place_strLable setFont:[UIFont systemFontOfSize:14]];
    _popular_place_strLable.textColor = [UIColor grayColor];
    
    _cover_imageView.frame = CGRectMake(10, 10, 110, 110);
    
    _ImageView.frame = CGRectMake(self.contentView.frame.size.width -40, 60, 20, 20);
        
}



-(void)setRec:(XDRecommend *)Rec
{
    if (Rec != _Rec) {
        [_Rec release];
        _Rec = [Rec retain];
    }
    _nameLabel.text = Rec.name;
    NSString *str = [NSString stringWithFormat:@"%@ %@天",Rec.first_day,Rec.day_count];
    _timeLable.text = str;
    
    _popular_place_strLable.text = Rec.popular_place_str;

    [_cover_imageView sd_setImageWithURL:[NSURL URLWithString:Rec.cover_image] placeholderImage:[UIImage imageNamed:@"a.jpg"]];
    
    _ImageView.image = [UIImage imageNamed:@"iconfont-fasong"];
    _ImageView1.image = [UIImage imageNamed:@"letu"];

}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
